<?php
/*
 * Created by generator
 *
 */

class Editniveau extends Controller {

	function Editniveau(){
		parent::Controller();
		$this->load->model('niveau_model');
		$this->load->library('session');
		$this->load->helper('url');
	}


	/**
	 * Affichage des infos
	 */
	public function index($nividniv){
		$model = niveau_model::getniveau($this->db, $nividniv);
		$data['niveau'] = $model;

		$this->load->view('editniveau_view',$data);
	}

	/**
	 * Sauvegarde des modifications
	 */
	public function save(){
		// Mise a jour des donnees en base
		$model = new niveau_model();
		$model->nividniv = $this->input->post('nividniv');
		$model->nivlbnom = $this->input->post('nivlbnom'); 
		$model->update($this->db);

		$this->session->set_flashdata('message', 'niveau mis a jour');

		redirect('listniveaus/index'); 
	}
	
}
?>
